import { config } from '../../config/index';
import { api } from '../../config/api';
import { request } from '../../utils/request';
/** 获取商品评论 */
function mockFetchComments(parmas) {
  const { delay } = require('../_utils/delay');
  const { getGoodsAllComments } = require('../../model/comments');
  return delay().then(() => getGoodsAllComments(parmas));
}

/** 获取商品评论 */
export function fetchComments(parmas) {
  // if (config.useMock) {
  //   return mockFetchComments(parmas);
  // }
  console.log('评论参数', parmas);
  const filter = {
    page: parmas.pageNum,
    pageSize: parmas.pageSize,
    ...parmas.queryParameter
  };
  return request.get(api.productComments, filter);
}
